define([
	'jquery',
	'underscore',
	'backbone',
	'text!tpl/ParkItemView.html',
	'text!../../assets/content/parks.json',
	'collections/ParksCollection',
	'models/ParksModel',
	'views/ParkItemView'
], function( $, _, Backbone, template, parksJSON, ParksCollection, ParksModel ) {

	var ParkItemView = Backbone.View.extend({

		template: _.template( template ),

		events: {

		},

		initialize: function() {
			this.getItem();
		},

		render: function() {
			this.$el.html(this.template(this.model.attributes))
			$(this.options.$parent).html(this.$el);
		},

		getItem: function(parkId){
			this.options.parkId = parkId || this.options.parkId;

			this.parksCollection = new ParksCollection(JSON.parse(parksJSON));
			this.initializeItem();
		},

		initializeItem: function(){
			this.model = this.parksCollection.get( this.options.parkId );
			this.render();
		}
	});

	return ParkItemView;
});
